home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / game / shoot / ADoom_src_1_2.lha / ADoom_src / p_local.h < prev    next >
C/C++ Source or Header  |  1998-02-24  |  7KB  |  293 lines

  1. // Emacs style mode select   -*- C++ -*- 
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // DESCRIPTION:
  18. //      Play functions, animation, global header.
  19. //
  20. //-----------------------------------------------------------------------------
  21.  
  22.  
  23. #ifndef __P_LOCAL__
  24. #define __P_LOCAL__
  25.  
  26. #ifndef __R_LOCAL__
  27. #include "r_local.h"
  28. #endif
  29.  
  30. #define FLOATSPEED              (FRACUNIT*4)
  31.  
  32. extern int MAXHEALTH;   // Dehacked
  33. #define VIEWHEIGHT              (41*FRACUNIT)
  34.  
  35. // mapblocks are used to check movement
  36. // against lines and things
  37. #define MAPBLOCKUNITS   128
  38. #define MAPBLOCKSIZE    (MAPBLOCKUNITS*FRACUNIT)
  39. #define MAPBLOCKSHIFT   (FRACBITS+7)
  40. #define MAPBMASK                (MAPBLOCKSIZE-1)
  41. #define MAPBTOFRAC              (MAPBLOCKSHIFT-FRACBITS)
  42.  
  43.  
  44. // player radius for movement checking
  45. #define PLAYERRADIUS    16*FRACUNIT
  46.  
  47. // MAXRADIUS is for precalculated sector block boxes
  48. // the spider demon is larger,
  49. // but we do not have any moving sectors nearby
  50. #define MAXRADIUS               32*FRACUNIT
  51.  
  52. #define GRAVITY         FRACUNIT
  53. #define MAXMOVE         (30*FRACUNIT)
  54.  
  55. #define USERANGE                (64*FRACUNIT)
  56. #define MELEERANGE              (64*FRACUNIT)
  57. #define MISSILERANGE    (32*64*FRACUNIT)
  58.  
  59. // follow a player exlusively for 3 seconds
  60. #define BASETHRESHOLD           100
  61.  
  62.  
  63.  
  64. //
  65. // P_TICK
  66. //
  67.  
  68. // both the head and tail of the thinker list
  69. extern  thinker_t       thinkercap;     
  70.  
  71.  
  72. void P_InitThinkers (void);
  73. void P_AddThinker (thinker_t* thinker);
  74. void P_RemoveThinker (thinker_t* thinker);
  75.  
  76.  
  77. //
  78. // P_PSPR
  79. //
  80. void P_SetupPsprites (player_t* curplayer);
  81. void P_MovePsprites (player_t* curplayer);
  82. void P_DropWeapon (player_t* player);
  83.  
  84.  
  85. //
  86. // P_USER
  87. //
  88. void    P_PlayerThink (player_t* player);
  89.  
  90.  
  91. //
  92. // P_MOBJ
  93. //
  94. #define ONFLOORZ                MININT
  95. #define ONCEILINGZ              MAXINT
  96.  
  97. // Time interval for item respawning.
  98. #define ITEMQUESIZE             128
  99.  
  100. extern mapthing_t       itemrespawnque[ITEMQUESIZE];
  101. extern int              itemrespawntime[ITEMQUESIZE];
  102. extern int              iquehead;
  103. extern int              iquetail;
  104.  
  105.  
  106. void P_RespawnSpecials (void);
  107.  
  108. mobj_t*
  109. P_SpawnMobj
  110. ( fixed_t       x,
  111.   fixed_t       y,
  112.   fixed_t       z,
  113.   mobjtype_t    type );
  114.  
  115. void    P_RemoveMobj (mobj_t* th);
  116. boolean P_SetMobjState (mobj_t* mobj, statenum_t state);
  117. #ifdef __SASC
  118. __far void      P_MobjThinker (mobj_t* mobj);
  119. #else
  120. void    P_MobjThinker (mobj_t* mobj);
  121. #endif
  122.  
  123. void    P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z);
  124. void    P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage);
  125. mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type);
  126. void    P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type);
  127.  
  128.  
  129. //
  130. // P_ENEMY
  131. //
  132. void P_NoiseAlert (mobj_t* target, mobj_t* emmiter);
  133.  
  134.  
  135. //
  136. // P_MAPUTL
  137. //
  138. typedef struct
  139. {
  140.     fixed_t     x;
  141.     fixed_t     y;
  142.     fixed_t     dx;
  143.     fixed_t     dy;
  144.     
  145. } divline_t;
  146.  
  147. typedef struct
  148. {
  149.     fixed_t     frac;           // along trace line
  150.     boolean     isaline;
  151.     union {
  152.         mobj_t* thing;
  153.         line_t* line;
  154.     }                   d;
  155. } intercept_t;
  156.  
  157. #define MAXINTERCEPTS   128
  158.  
  159. extern intercept_t      intercepts[MAXINTERCEPTS];
  160. extern intercept_t*     intercept_p;
  161.  
  162. typedef boolean (*traverser_t) (intercept_t *in);
  163.  
  164. fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
  165. int     P_PointOnLineSide (fixed_t x, fixed_t y, line_t* line);
  166. int     P_PointOnDivlineSide (fixed_t x, fixed_t y, divline_t* line);
  167. void    P_MakeDivline (line_t* li, divline_t* dl);
  168. fixed_t P_InterceptVector (divline_t* v2, divline_t* v1);
  169. int     P_BoxOnLineSide (fixed_t* tmbox, line_t* ld);
  170.  
  171. extern fixed_t          opentop;
  172. extern fixed_t          openbottom;
  173. extern fixed_t          openrange;
  174. extern fixed_t          lowfloor;
  175.  
  176. void    P_LineOpening (line_t* linedef);
  177.  
  178. boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
  179. boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
  180.  
  181. #define PT_ADDLINES             1
  182. #define PT_ADDTHINGS    2
  183. #define PT_EARLYOUT             4
  184.  
  185. extern divline_t        trace;
  186.  
  187. boolean
  188. P_PathTraverse
  189. ( fixed_t       x1,
  190.   fixed_t       y1,
  191.   fixed_t       x2,
  192.   fixed_t       y2,
  193.   int           flags,
  194.   boolean       (*trav) (intercept_t *));
  195.  
  196. void P_UnsetThingPosition (mobj_t* thing);
  197. void P_SetThingPosition (mobj_t* thing);
  198.  
  199.  
  200. //
  201. // P_MAP
  202. //
  203.  
  204. // If "floatok" true, move would be ok
  205. // if within "tmfloorz - tmceilingz".
  206. extern boolean          floatok;
  207. extern fixed_t          tmfloorz;
  208. extern fixed_t          tmceilingz;
  209.  
  210.  
  211. extern  line_t*         ceilingline;
  212.  
  213. boolean P_CheckPosition (mobj_t *thing, fixed_t x, fixed_t y);
  214. boolean P_TryMove (mobj_t* thing, fixed_t x, fixed_t y);
  215. boolean P_TeleportMove (mobj_t* thing, fixed_t x, fixed_t y);
  216. void    P_SlideMove (mobj_t* mo);
  217. boolean P_CheckSight (mobj_t* t1, mobj_t* t2);
  218. void    P_UseLines (player_t* player);
  219.  
  220. boolean P_ChangeSector (sector_t* sector, boolean crunch);
  221.  
  222. extern mobj_t*  linetarget;     // who got hit (or NULL)
  223.  
  224. fixed_t
  225. P_AimLineAttack
  226. ( mobj_t*       t1,
  227.   angle_t       angle,
  228.   fixed_t       distance );
  229.  
  230. void
  231. P_LineAttack
  232. ( mobj_t*       t1,
  233.   angle_t       angle,
  234.   fixed_t       distance,
  235.   fixed_t       slope,
  236.   int           damage );
  237.  
  238. void
  239. P_RadiusAttack
  240. ( mobj_t*       spot,
  241.   mobj_t*       source,
  242.   int           damage );
  243.  
  244.  
  245.  
  246. //
  247. // P_SETUP
  248. //
  249. extern byte*            rejectmatrix;   // for fast sight rejection
  250. extern short*           blockmaplump;   // offsets in blockmap are from here
  251. extern short*           blockmap;
  252. extern int              bmapwidth;
  253. extern int              bmapheight;     // in mapblocks
  254. extern fixed_t          bmaporgx;
  255. extern fixed_t          bmaporgy;       // origin of block map
  256. extern mobj_t**         blocklinks;     // for thing chains
  257.  
  258.  
  259.  
  260. //
  261. // P_INTER
  262. //
  263. extern int              maxammo[NUMAMMO];
  264. extern int              clipammo[NUMAMMO];
  265.  
  266. void
  267. P_TouchSpecialThing
  268. ( mobj_t*       special,
  269.   mobj_t*       toucher );
  270.  
  271. void
  272. P_DamageMobj
  273. ( mobj_t*       target,
  274.   mobj_t*       inflictor,
  275.   mobj_t*       source,
  276.   int           damage );
  277.  
  278.  
  279. //
  280. // P_SPEC
  281. //
  282. #include "p_spec.h"
  283.  
  284.  
  285. #endif  // __P_LOCAL__
  286. //-----------------------------------------------------------------------------
  287. //
  288. // $Log:$
  289. //
  290. //-----------------------------------------------------------------------------
  291.  
  292.  
  293.